package com.link.base.base.appinfo.dao.mybatis.mapper;

import com.link.base.base.appinfo.model.AppMobileInfo;
import com.link.base.base.appinfo.model.AppMobileUser;
import com.link.base.base.appinfo.model.LoadFlag;
import com.link.core.basic.dao.mapper.BasicMapper;

import java.util.List;

/**
 * 设备
 *
 * @author ouyangzhenqiang
 * @date 2018/10/16
 */
public interface AppMobileInfoMapper extends BasicMapper<AppMobileInfo> {

    /**
     * 获取设备统计数据
     *
     * @author ouyangzhenqiang
     * @date 2018/10/16
     * @param record
     */
    List<AppMobileInfo> queryDeviceNumber(AppMobileInfo record) throws Exception;

    /**
     * 查询7日内 每日新增设备
     *
     * @author ouyangzhenqiang
     * @date 2019/08/29 10:58
     */
    List<AppMobileInfo> queryNewDeviceNumber(AppMobileInfo record) throws Exception;

    /**
     * 查询当日活跃设备
     *
     * @author ouyangzhenqiang
     * @date 2019/08/29 10:58
     */
    AppMobileInfo queryLiveDeviceNumber(AppMobileInfo record) throws Exception;
    
    /**
     * 查询机型分布
     * 
     * @author ouyangzhenqiang
     * @date 2019/08/29 11:07
     */
    List<AppMobileInfo> queryMobileTypeNumber(AppMobileInfo record) throws Exception;

    /**
     * 查询地区分布
     *
     * @author ouyangzhenqiang
     * @date 2019/08/29 11:07
     */
    List<AppMobileInfo> queryProvinceNumber(AppMobileInfo record) throws Exception;

    /**
     * 查询一段时间内活跃设备数量
     *
     * @author ouyangzhenqiang
     * @date 2018/10/16
     * @param record
     */
    AppMobileInfo queryActiveNumber(AppMobileInfo record) throws Exception;

    /**
     * 判断设备是否已经注册
     *
     * @author ouyangzhenqiang
     * @date 2018/10/16
     * @param record
     */
    List<AppMobileInfo> mobileCheck(AppMobileInfo record) throws Exception;

    /**
     * 清空用户与设备之间的关联
     *
     * @author ouyangzhenqiang
     * @date 2018/10/16
     * @param record
     */
    void mobileClearUpdate(AppMobileInfo record) throws Exception;

    /**
     * 更新设备绑定的用户
     *
     * @author ouyangzhenqiang
     * @date 2018/10/16
     * @param record
     */
    void mobileInfoUpdate(AppMobileInfo record) throws Exception;

    /**
     * 获取设备
     *
     * @author ouyangzhenqiang
     * @date 2018/10/16
     * @param record
     */
    List<AppMobileInfo> getMobileInfo(AppMobileInfo record) throws Exception;

    /**
     * 查询数据库检测表，用于判断是否需要重新加载基础数据
     *
     * @author ouyangzhenqiang
     * @date 2018/10/16
     * @param temp
     */
    List<LoadFlag> getLoadDataFlag(LoadFlag temp) throws Exception;

    /**
     * 新建设备用户中间表记录
     *
     * @author ouyangzhenqiang
     * @date 2019/11/28 17:38
     */
    void mobileUserInsert(AppMobileUser record) throws Exception;

    /**
     * 判断设备用户中间表记录是否存在
     *
     * @author ouyangzhenqiang
     * @date 2019/11/28 17:39
     */
    int mobileUserCheck(AppMobileUser record) throws Exception;

    /**
     * 获取设备登录历史用户
     *
     * @author ouyangzhenqiang
     * @date 2019/11/28 18:08
     */
    List<AppMobileUser> mobileUserListPage(AppMobileUser record) throws Exception;
}
